﻿@using Orchard.Utility.Extensions;
@using Orchard.Widgets.Models;
@using So.WidgetThemeLayers.Models
@{
    Style.Require("WidgetsAdmin");
    Script.Require("Switchable");
    Style.Require("Switchable");
    IEnumerable<ThemeViewModel> themes = Model.Themes;
    var returnUrl = Request.RawUrl;
}
<div id="widgets-theme-layers-control" class="widgets-container">
    @if (themes != null && themes.Any())
    {
        using (Html.BeginForm("index", "admin", FormMethod.Get, new { area = "So.WidgetThemeLayers" }))
        {
        <fieldset class="bulk-actions-auto">
            <label for="themeId">@T("Theme filter")</label>
            <select id="themeId" name="themeId">
                @Html.SelectOption("", true, T("All").Text)
                @foreach (var layer in themes)
                {
                    @Html.SelectOption(layer.Id, (string)Model.CurrentThemeFilter == layer.Id, (string)layer.Name)
                }
            </select>
            <button type="submit" class="apply-bulk-actions-auto">@T("Show")</button>
            <span class="hint" id="widgets-layer-description">@T("Displays selected theme as current theme, filters zones and layers by rule: theme(\"team-name\")")</span>
        </fieldset>
        }
    }

</div>

